package com.question.java.time.exec05;

import java.time.*;
import java.time.format.DateTimeFormatter;

/**
 * @Description: 解析与格式化
 * 自定义格式
 * @Author: Jun Yang
 */
public class DateTimeExample31 {

    public static void main(String[] args) {
        ZonedDateTime zonedDateTime = ZonedDateTime.of(
                LocalDate.of(2018, Month.NOVEMBER, 21),
                LocalTime.of(17, 8),
                ZoneId.of("UTC"));

        System.out.println(zonedDateTime.format(DateTimeFormatter.ISO_DATE_TIME));

        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");

        System.out.println(zonedDateTime.format(formatter));

        formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");

        System.out.println(zonedDateTime.format(formatter));
    }
}
